home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 10 / AACD 10.iso / AACD / Games / MAME / src / drivers / pbaction.c < prev    next >
C/C++ Source or Header  |  2000-04-04  |  13KB  |  393 lines

  1. /***************************************************************************
  2.  
  3. Pinball Action memory map (preliminary)
  4.  
  5. driver by Nicola Salmoria
  6.  
  7.  
  8. 0000-9fff ROM
  9. d000-d3ff Video RAM
  10. d400-d7ff Color RAM
  11. d800-dbff Background Video RAM
  12. dc00-dfff Background Color RAM
  13. e000-e07f Sprites
  14. e400-e5ff Palette RAM
  15.  
  16. read:
  17. e600      IN0
  18. e601      IN1
  19. e602      IN2
  20. e604      DSW1
  21. e605      DSW2
  22. e606      watchdog reset????
  23.  
  24. write:
  25. e600      interrupt enable
  26. e604      flip screen
  27. e606      bg scroll? not sure
  28. e800      command for the sound CPU
  29.  
  30.  
  31. Notes:
  32. - pbactio2 has a ROM for a third Z80, not emulated, function unknown
  33.  
  34. ***************************************************************************/
  35.  
  36. #include "driver.h"
  37. #include "vidhrdw/generic.h"
  38. #include "machine/z80fmly.h"
  39.  
  40.  
  41. extern unsigned char *pbaction_videoram2,*pbaction_colorram2;
  42. WRITE_HANDLER( pbaction_videoram2_w );
  43. WRITE_HANDLER( pbaction_colorram2_w );
  44. WRITE_HANDLER( pbaction_flipscreen_w );
  45. WRITE_HANDLER( pbaction_scroll_w );
  46. int pbaction_vh_start(void);
  47. void pbaction_vh_stop(void);
  48.  
  49. void pbaction_vh_screenrefresh(struct osd_bitmap *bitmap,int full_refresh);
  50.  
  51.  
  52. static WRITE_HANDLER( pbaction_sh_command_w )
  53. {
  54.     soundlatch_w(offset,data);
  55.     cpu_cause_interrupt(1,0x00);
  56. }
  57.  
  58.  
  59.  
  60. static struct MemoryReadAddress readmem[] =
  61. {
  62.     { 0x0000, 0x9fff, MRA_ROM },
  63.     { 0xc000, 0xdfff, MRA_RAM },
  64.     { 0xe000, 0xe07f, MRA_RAM },
  65.     { 0xe400, 0xe5ff, MRA_RAM },
  66.     { 0xe600, 0xe600, input_port_0_r },    /* IN0 */
  67.     { 0xe601, 0xe601, input_port_1_r },    /* IN1 */
  68.     { 0xe602, 0xe602, input_port_2_r },    /* IN2 */
  69.     { 0xe604, 0xe604, input_port_3_r },    /* DSW1 */
  70.     { 0xe605, 0xe605, input_port_4_r },    /* DSW2 */
  71.     { 0xe606, 0xe606, MRA_NOP },    /* ??? */
  72.     { -1 }  /* end of table */
  73. };
  74.  
  75. static struct MemoryWriteAddress writemem[] =
  76. {
  77.     { 0x0000, 0x9fff, MWA_ROM },
  78.     { 0xc000, 0xcfff, MWA_RAM },
  79.     { 0xd000, 0xd3ff, videoram_w, &videoram, &videoram_size },
  80.     { 0xd400, 0xd7ff, colorram_w, &colorram },
  81.     { 0xd800, 0xdbff, pbaction_videoram2_w, &pbaction_videoram2 },
  82.     { 0xdc00, 0xdfff, pbaction_colorram2_w, &pbaction_colorram2 },
  83.     { 0xe000, 0xe07f, MWA_RAM, &spriteram, &spriteram_size },
  84.     { 0xe400, 0xe5ff, paletteram_xxxxBBBBGGGGRRRR_w, &paletteram },
  85.     { 0xe600, 0xe600, interrupt_enable_w },
  86.     { 0xe604, 0xe604, pbaction_flipscreen_w },
  87.     { 0xe606, 0xe606, pbaction_scroll_w },
  88.     { 0xe800, 0xe800, pbaction_sh_command_w },
  89.     { -1 }  /* end of table */
  90. };
  91.  
  92. static struct MemoryReadAddress sound_readmem[] =
  93. {
  94.     { 0x0000, 0x1fff, MRA_ROM },
  95.     { 0x4000, 0x47ff, MRA_RAM },
  96.     { 0x8000, 0x8000, soundlatch_r },
  97.     { -1 }    /* end of table */
  98. };
  99.  
  100. static struct MemoryWriteAddress sound_writemem[] =
  101. {
  102.     { 0x0000, 0x1fff, MWA_ROM },
  103.     { 0x4000, 0x47ff, MWA_RAM },
  104.     { 0xffff, 0xffff, MWA_NOP },    /* watchdog? */
  105.     { -1 }    /* end of table */
  106. };
  107.  
  108.  
  109. static struct IOWritePort sound_writeport[] =
  110. {
  111.     { 0x10, 0x10, AY8910_control_port_0_w },
  112.     { 0x11, 0x11, AY8910_write_port_0_w },
  113.     { 0x20, 0x20, AY8910_control_port_1_w },
  114.     { 0x21, 0x21, AY8910_write_port_1_w },
  115.     { 0x30, 0x30, AY8910_control_port_2_w },
  116.     { 0x31, 0x31, AY8910_write_port_2_w },
  117.     { -1 }    /* end of table */
  118. };
  119.  
  120.  
  121. INPUT_PORTS_START( pbaction )
  122.     PORT_START    /* IN0 */
  123.     PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON3 )
  124.     PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_UNKNOWN )
  125.     PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_BUTTON4 )
  126.     PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_BUTTON1 )
  127.     PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_BUTTON2 )
  128.     PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_UNKNOWN )
  129.     PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_UNKNOWN )
  130.     PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_UNKNOWN )
  131.  
  132.     PORT_START    /* IN1 */
  133.     PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON3 | IPF_COCKTAIL )
  134.     PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_UNKNOWN )
  135.     PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_BUTTON4 | IPF_COCKTAIL )
  136.     PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_BUTTON1 | IPF_COCKTAIL )
  137.     PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_BUTTON2 | IPF_COCKTAIL )
  138.     PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_UNKNOWN )
  139.     PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_UNKNOWN )
  140.     PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_UNKNOWN )
  141.  
  142.     PORT_START    /* IN2 */
  143.     PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_COIN1 )
  144.     PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_COIN2 )
  145.     PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_START1 )
  146.     PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_START2 )
  147.     PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_UNKNOWN )
  148.     PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_UNKNOWN )
  149.     PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_UNKNOWN )
  150.     PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_UNKNOWN )
  151.  
  152.     PORT_START    /* DSW0 */
  153.     PORT_DIPNAME( 0x03, 0x00, DEF_STR( Coin_B ) )
  154.     PORT_DIPSETTING(    0x00, DEF_STR( 1C_1C ) )
  155.     PORT_DIPSETTING(    0x01, DEF_STR( 1C_2C ) )
  156.     PORT_DIPSETTING(    0x02, DEF_STR( 1C_3C ) )
  157.     PORT_DIPSETTING(    0x03, DEF_STR( 1C_6C ) )
  158.     PORT_DIPNAME( 0x0c, 0x00, DEF_STR( Coin_A ) )
  159.     PORT_DIPSETTING(    0x04, DEF_STR( 2C_1C ) )
  160.     PORT_DIPSETTING(    0x00, DEF_STR( 1C_1C ) )
  161.     PORT_DIPSETTING(    0x08, DEF_STR( 1C_2C ) )
  162.     PORT_DIPSETTING(    0x0c, DEF_STR( 1C_3C ) )
  163.     PORT_DIPNAME( 0x30, 0x00, DEF_STR( Lives ) )
  164.     PORT_DIPSETTING(    0x30, "2" )
  165.     PORT_DIPSETTING(    0x00, "3" )
  166.     PORT_DIPSETTING(    0x10, "4" )
  167.     PORT_DIPSETTING(    0x20, "5" )
  168.     PORT_DIPNAME( 0x40, 0x40, DEF_STR( Cabinet ) )
  169.     PORT_DIPSETTING(    0x40, DEF_STR( Upright ) )
  170.     PORT_DIPSETTING(    0x00, DEF_STR( Cocktail ) )
  171.     PORT_DIPNAME( 0x80, 0x00, DEF_STR( Demo_Sounds ) )
  172.     PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
  173.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  174.  
  175.     PORT_START    /* DSW1 */
  176.     PORT_DIPNAME( 0x07, 0x00, DEF_STR( Bonus_Life ) )
  177.     PORT_DIPSETTING(    0x01, "70K 200K 1000K" )
  178.     PORT_DIPSETTING(    0x00, "70K 200K" )
  179.     PORT_DIPSETTING(    0x04, "100K 300K 1000K" )
  180.     PORT_DIPSETTING(    0x03, "100K 300K" )
  181.     PORT_DIPSETTING(    0x02, "100K" )
  182.     PORT_DIPSETTING(    0x06, "200K 1000K" )
  183.     PORT_DIPSETTING(    0x05, "200K" )
  184.     PORT_DIPSETTING(    0x07, "None" )
  185.     PORT_DIPNAME( 0x08, 0x00, "Extra" )
  186.     PORT_DIPSETTING(    0x00, "Easy" )
  187.     PORT_DIPSETTING(    0x08, "Hard" )
  188.     PORT_DIPNAME( 0x30, 0x00, "Difficulty (Flippers)" )
  189.     PORT_DIPSETTING(    0x00, "Easy" )
  190.     PORT_DIPSETTING(    0x10, "Medium" )
  191.     PORT_DIPSETTING(    0x20, "Hard" )
  192.     PORT_DIPSETTING(    0x30, "Hardest" )
  193.     PORT_DIPNAME( 0xc0, 0x00, "Difficulty (Outlanes)" )
  194.     PORT_DIPSETTING(    0x00, "Easy" )
  195.     PORT_DIPSETTING(    0x40, "Medium" )
  196.     PORT_DIPSETTING(    0x80, "Hard" )
  197.     PORT_DIPSETTING(    0xc0, "Hardest" )
  198. INPUT_PORTS_END
  199.  
  200.  
  201.  
  202. static struct GfxLayout charlayout1 =
  203. {
  204.     8,8,    /* 8*8 characters */
  205.     1024,    /* 1024 characters */
  206.     3,    /* 3 bits per pixel */
  207.     { 0, 1024*8*8, 2*1024*8*8 },    /* the bitplanes are separated */
  208.     { 0, 1, 2, 3, 4, 5, 6, 7 },    /* pretty straightforward layout */
  209.     { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 },
  210.     8*8    /* every char takes 8 consecutive bytes */
  211. };
  212. static struct GfxLayout charlayout2 =
  213. {
  214.     8,8,    /* 8*8 characters */
  215.     2048,    /* 2048 characters */
  216.     4,    /* 4 bits per pixel */
  217.     { 0, 2048*8*8, 2*2048*8*8, 3*2048*8*8 },    /* the bitplanes are separated */
  218.     { 0, 1, 2, 3, 4, 5, 6, 7 },    /* pretty straightforward layout */
  219.     { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 },
  220.     8*8    /* every char takes 8 consecutive bytes */
  221. };
  222. static struct GfxLayout spritelayout1 =
  223. {
  224.     16,16,    /* 16*16 sprites */
  225.     128,    /* 128 sprites */
  226.     3,    /* 3 bits per pixel */
  227.     { 0, 256*16*16, 2*256*16*16 },    /* the bitplanes are separated */
  228.     { 0, 1, 2, 3, 4, 5, 6, 7,    /* pretty straightforward layout */
  229.             8*8+0, 8*8+1, 8*8+2, 8*8+3, 8*8+4, 8*8+5, 8*8+6, 8*8+7 },
  230.     { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8,
  231.             16*8, 17*8, 18*8, 19*8, 20*8, 21*8, 22*8, 23*8 },
  232.     32*8    /* every sprite takes 32 consecutive bytes */
  233. };
  234. static struct GfxLayout spritelayout2 =
  235. {
  236.     32,32,    /* 32*32 sprites */
  237.     32,    /* 32 sprites */
  238.     3,    /* 3 bits per pixel */
  239.     { 0*64*32*32, 1*64*32*32, 2*64*32*32 },    /* the bitplanes are separated */
  240.     { 0, 1, 2, 3, 4, 5, 6, 7,    /* pretty straightforward layout */
  241.             8*8+0, 8*8+1, 8*8+2, 8*8+3, 8*8+4, 8*8+5, 8*8+6, 8*8+7,
  242.             32*8+0, 32*8+1, 32*8+2, 32*8+3, 32*8+4, 32*8+5, 32*8+6, 32*8+7,
  243.             40*8+0, 40*8+1, 40*8+2, 40*8+3, 40*8+4, 40*8+5, 40*8+6, 40*8+7 },
  244.     { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8,
  245.             16*8, 17*8, 18*8, 19*8, 20*8, 21*8, 22*8, 23*8,
  246.             64*8, 65*8, 66*8, 67*8, 68*8, 69*8, 70*8, 71*8,
  247.             80*8, 81*8, 82*8, 83*8, 84*8, 85*8, 86*8, 87*8 },
  248.     128*8    /* every sprite takes 128 consecutive bytes */
  249. };
  250.  
  251.  
  252.  
  253. static struct GfxDecodeInfo gfxdecodeinfo[] =
  254. {
  255.     { REGION_GFX1, 0x00000, &charlayout1,    0, 16 },    /*   0-127 characters */
  256.     { REGION_GFX2, 0x00000, &charlayout2,  128,  8 },    /* 128-255 background */
  257.     { REGION_GFX3, 0x00000, &spritelayout1,  0, 16 },    /*   0-127 normal sprites */
  258.     { REGION_GFX3, 0x01000, &spritelayout2,  0, 16 },    /*   0-127 large sprites */
  259.     { -1 } /* end of array */
  260. };
  261.  
  262.  
  263. static struct AY8910interface ay8910_interface =
  264. {
  265.     3,    /* 3 chips */
  266.     1500000,    /* 1.5 MHz?????? */
  267.     { 25, 25, 25 },
  268.     { 0 },
  269.     { 0 },
  270.     { 0 },
  271.     { 0 }
  272. };
  273.  
  274.  
  275. int pbaction_interrupt(void)
  276. {
  277.     return  0x02;    /* the CPU is in Interrupt Mode 2 */
  278. }
  279.  
  280.  
  281. static struct MachineDriver machine_driver_pbaction =
  282. {
  283.     /* basic machine hardware */
  284.     {
  285.         {
  286.             CPU_Z80,
  287.             4000000,    /* 4 Mhz? */
  288.             readmem,writemem,0,0,
  289.             nmi_interrupt,1
  290.         },
  291.         {
  292.             CPU_Z80 | CPU_AUDIO_CPU,
  293.             3072000,    /* 3.072 Mhz (?????) */
  294.             sound_readmem,sound_writemem,0,sound_writeport,
  295.             pbaction_interrupt,2    /* ??? */
  296.                                     /* IRQs are caused by the main CPU */
  297.         },
  298.     },
  299.     60, DEFAULT_60HZ_VBLANK_DURATION,    /* frames per second, vblank duration */
  300.     1,    /* 1 CPU slice per frame - interleaving is forced when a sound command is written */
  301.     0,
  302.  
  303.     /* video hardware */
  304.     32*8, 32*8, { 0*8, 32*8-1, 2*8, 30*8-1 },
  305.     gfxdecodeinfo,
  306.     256, 256,
  307.     0,
  308.  
  309.     VIDEO_TYPE_RASTER | VIDEO_MODIFIES_PALETTE,
  310.     0,
  311.     pbaction_vh_start,
  312.     pbaction_vh_stop,
  313.     pbaction_vh_screenrefresh,
  314.  
  315.     /* sound hardware */
  316.     0,0,0,0,
  317.     {
  318.         {
  319.             SOUND_AY8910,
  320.             &ay8910_interface
  321.         }
  322.     }
  323. };
  324.  
  325.  
  326.  
  327. /***************************************************************************
  328.  
  329.   Game driver(s)
  330.  
  331. ***************************************************************************/
  332.  
  333. ROM_START( pbaction )
  334.     ROM_REGION( 0x10000, REGION_CPU1 )    /* 64k for code */
  335.     ROM_LOAD( "b-p7.bin",     0x0000, 0x4000, 0x8d6dcaae )
  336.     ROM_LOAD( "b-n7.bin",     0x4000, 0x4000, 0xd54d5402 )
  337.     ROM_LOAD( "b-l7.bin",     0x8000, 0x2000, 0xe7412d68 )
  338.  
  339.     ROM_REGION( 0x10000, REGION_CPU2 )    /* 64k for sound board */
  340.     ROM_LOAD( "a-e3.bin",     0x0000,  0x2000, 0x0e53a91f )
  341.  
  342.     ROM_REGION( 0x06000, REGION_GFX1 | REGIONFLAG_DISPOSE )
  343.     ROM_LOAD( "a-s6.bin",     0x00000, 0x2000, 0x9a74a8e1 )
  344.     ROM_LOAD( "a-s7.bin",     0x02000, 0x2000, 0x5ca6ad3c )
  345.     ROM_LOAD( "a-s8.bin",     0x04000, 0x2000, 0x9f00b757 )
  346.  
  347.     ROM_REGION( 0x10000, REGION_GFX2 | REGIONFLAG_DISPOSE )
  348.     ROM_LOAD( "a-j5.bin",     0x00000, 0x4000, 0x21efe866 )
  349.     ROM_LOAD( "a-j6.bin",     0x04000, 0x4000, 0x7f984c80 )
  350.     ROM_LOAD( "a-j7.bin",     0x08000, 0x4000, 0xdf69e51b )
  351.     ROM_LOAD( "a-j8.bin",     0x0c000, 0x4000, 0x0094cb8b )
  352.  
  353.     ROM_REGION( 0x06000, REGION_GFX3 | REGIONFLAG_DISPOSE )
  354.     ROM_LOAD( "b-c7.bin",     0x00000, 0x2000, 0xd1795ef5 )
  355.     ROM_LOAD( "b-d7.bin",     0x02000, 0x2000, 0xf28df203 )
  356.     ROM_LOAD( "b-f7.bin",     0x04000, 0x2000, 0xaf6e9817 )
  357. ROM_END
  358.  
  359.  
  360. ROM_START( pbactio2 )
  361.     ROM_REGION( 0x10000, REGION_CPU1 )    /* 64k for code */
  362.     ROM_LOAD( "pba16.bin",     0x0000, 0x4000, 0x4a239ebd )
  363.     ROM_LOAD( "pba15.bin",     0x4000, 0x4000, 0x3afef03a )
  364.     ROM_LOAD( "pba14.bin",     0x8000, 0x2000, 0xc0a98c8a )
  365.  
  366.     ROM_REGION( 0x10000, REGION_CPU2 )    /* 64k for sound board */
  367.     ROM_LOAD( "pba1.bin",     0x0000,  0x2000, 0x8b69b933 )
  368.  
  369.     ROM_REGION( 0x10000, REGION_CPU3 )    /* 64k for a third Z80 (not emulated) */
  370.     ROM_LOAD( "pba17.bin",    0x0000,  0x4000, 0x2734ae60 )
  371.  
  372.     ROM_REGION( 0x06000, REGION_GFX1 | REGIONFLAG_DISPOSE )
  373.     ROM_LOAD( "a-s6.bin",     0x00000, 0x2000, 0x9a74a8e1 )
  374.     ROM_LOAD( "a-s7.bin",     0x02000, 0x2000, 0x5ca6ad3c )
  375.     ROM_LOAD( "a-s8.bin",     0x04000, 0x2000, 0x9f00b757 )
  376.  
  377.     ROM_REGION( 0x10000, REGION_GFX2 | REGIONFLAG_DISPOSE )
  378.     ROM_LOAD( "a-j5.bin",     0x00000, 0x4000, 0x21efe866 )
  379.     ROM_LOAD( "a-j6.bin",     0x04000, 0x4000, 0x7f984c80 )
  380.     ROM_LOAD( "a-j7.bin",     0x08000, 0x4000, 0xdf69e51b )
  381.     ROM_LOAD( "a-j8.bin",     0x0c000, 0x4000, 0x0094cb8b )
  382.  
  383.     ROM_REGION( 0x06000, REGION_GFX3 | REGIONFLAG_DISPOSE )
  384.     ROM_LOAD( "b-c7.bin",     0x00000, 0x2000, 0xd1795ef5 )
  385.     ROM_LOAD( "b-d7.bin",     0x02000, 0x2000, 0xf28df203 )
  386.     ROM_LOAD( "b-f7.bin",     0x04000, 0x2000, 0xaf6e9817 )
  387. ROM_END
  388.  
  389.  
  390.  
  391. GAME( 1985, pbaction, 0,        pbaction, pbaction, 0, ROT90, "Tehkan", "Pinball Action (set 1)" )
  392. GAME( 1985, pbactio2, pbaction, pbaction, pbaction, 0, ROT90, "Tehkan", "Pinball Action (set 2)" )
  393.